<?php
/**
 * Created by PhpStorm.
 * User: chenzhitao
 * Date: 2018/3/20
 * Time: 上午9:38
 */

namespace app\wap\controller;


use app\index\model\Dist;
use app\index\model\SubCategory;
use think\Controller;
use app\index\model\Company as companyModel;

class Company extends Controller
{
    /**
     * 显示资源列表
     *
     * @return \think\Response
     */
    public function index($options)
    {
        if($options){
            $option_array = explode("g",$options);
            $staId=$option_array[0];
            $id = $option_array[1];
            $idCity = $option_array[2];
        }else{
            $staId = 'multi';
            $id = 0;
            $idCity = 0;
        }


        if($staId == null){
            $staId = 'multi';
        }
        if($id == null){
            $id = 0;
        }
        if($idCity == null){
            $idCity = 0;
        }
        $category_name = SubCategory::getCategoryNameById($id);
        $city_name = Dist::getDistNameById($idCity);

        return $this->fetch("companyList",["staId"=>$staId, "id"=>$id, "idCity"=>$idCity ,"category_name"=>$category_name,"city_name"=>$city_name]);
    }
    public function getDeitail($id){
        $seoInfo = companyModel::getSeoInfoById($id);
        $title = $seoInfo['title'];
        $desc = $seoInfo['desc'];
        return $this->fetch("companyDetail",["id"=>$id,"title"=>$title,"desc"=>$desc]);
    }
   
}